package be.ac.ua.codebase;

import java.io.Serializable;
import java.util.UUID;

public class Product implements Serializable, Comparable<Object> {
	private static final long serialVersionUID = 1L;
	private UUID fID;
	private String fName;
	
	public Product(String name) {
		fName = name;
		fID = UUID.randomUUID();
	}	

	public int compareTo(Object object) {
		if (object instanceof Product) {
			Product product = (Product)object;
			System.out.println("compare " + product.fName + " to " + this.fName);
			if (product.fName.contentEquals(this.fName)) {
				return 2;
			} else if ((this.fName.contains(product.fName)) || (product.fName.contains(this.fName))) {
				return 1;
			}
		}
		return 0;
	}
	
	public String getName() {
		return fName;
	}
	
	public UUID getID() {
		return fID;
	}
}
